<template>
  <el-card>
    <el-table :data="tableData.rows" style="width: 100%">
      <el-table-column type="selection" width="55" />
      <el-table-column prop="approvalNumber" label="审批编号" />
      <el-table-column prop="title" label="审批标题" />
      <el-table-column prop="startTime" label="发起时间" />
      <el-table-column prop="employeeName" label="发起人" />
      <el-table-column prop="status" label="审批状态">
        <template #default="{ row }">
          <el-tag :type="row.status === 'approved' ? 'success' : 'info'">{{ row.status }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="100">
        <template #default="{ row }">
          <el-link type="primary" @click="goDetail(row)">查看详情</el-link>
        </template>
      </el-table-column>
    </el-table>
    <!-- <el-pagination
      class="mt-2"
      background
      layout="prev, pager, next"
      :total="tableData.total"
      :page-size="10"
      v-model:current-page="currentPage"
    /> -->
  </el-card>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import {get} from '@/api/approval/approvalManagement/approvalManagement.js'

const router = useRouter()
const currentPage = ref(1)
const tableData = ref([
  { id: '20210225154222775', title: '员工入职审批', date: '2022-01-02 10:09:00', user: '晏文滴', status: '审批中' },
  // ...更多数据
])

onMounted(() => {
  get({ }).then((res) => {
    console.log(res)
    tableData.value = res
    console.log(tableData.value)
  })
})

function goDetail(item) {
    // console.log(item)
  router.push({ path: '/approval/approvalDetail', query:item  })
}
</script>